package limedia.sdk.api.realtime;

import java.util.HashMap;
import java.util.Map;

public class TSRTMediaManager {
	
	private static TSRTMediaManager mInstance = null;
	
	private Map<String, TSRealTimePlayer> mRealTimePlayers = null;
	
	public static synchronized TSRTMediaManager getInstance() {
		if(null == mInstance) {
			mInstance = new TSRTMediaManager();
		}
		return mInstance;
	}
	
	private TSRTMediaManager() {
		super();
		
		this.mRealTimePlayers = new HashMap<String, TSRealTimePlayer>();
	}
	
	public static void addPlayer(String clientID, TSRealTimePlayer player) {
		getInstance().mRealTimePlayers.put(clientID, player);
	}
	
	public static void startPlayer(String clientID){
		TSRealTimePlayer player = getInstance().mRealTimePlayers.get(clientID);
		if(null != player) {
			player.start();
		}
	}
	
	public static void stopPlayer(String clientID) {
		TSRealTimePlayer player = getInstance().mRealTimePlayers.get(clientID);
		if(null != player) {
			player.stop();
		}
	}
}
